package controllers

import (
	"blog_api/models"
	"github.com/gin-gonic/gin"
	"strconv"
	"strings"
)

type PageVisitLogController struct {
	BaseController
}

/**
 * AdminPrVisitList
 * @Description: 管理后台——页面访问日志
 * @Author: Jazk-Z
 * @receiver l
 * @param c
 */
func (l PageVisitLogController) AdminPvlList(c *gin.Context) {
	keyword := strings.TrimSpace(c.DefaultQuery("keyword", ""))
	page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
	limit, _ := strconv.Atoi(c.DefaultQuery("limit", "10"))
	offset := (page - 1) * limit

	list, total := models.AdminPvl(limit, offset, "*", keyword)
	data := make(map[string]interface{})
	data["list"] = list
	data["total"] = total
	l.success(c, "success", data)
	return
}
